<h2>thread_set_special_port</h2>
<hr>
<p>
<strong>Function</strong> - Set caller-specified special port belonging to the target thread.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   thread_set_special_port</strong>
                <strong>(thread_act_t</strong>                            <var>thread</var>,
                 <strong>int</strong>                                 <var>which_port</var>,
                 <strong>mach_port_t</strong>                       <var>special_port</var><strong>);</strong>
</pre>

<h4>Macro form:</h4>
<pre>
<strong>kern_return_t   thread_set_kernel_port</strong>
                <strong>(thread_act_t</strong>                            <var>thread</var>,
                 <strong>mach_port_t</strong>                       <var>special_port</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>thread</var> 
<dd>
[in thread send right]
The thread for which to set the port.
<p>
<dt> <var>which_port</var> 
<dd>
[in scalar]
The special port to be set.  Valid values are:
<dl>
<p>
<dt> <strong>THREAD_KERNEL_PORT</strong>
<dd>
[thread-self port] The thread's kernel port.  Used by the kernel 
to receive messages from the thread.  This is the movable
port for the thread and different from <strong>mach_thread_self</strong>(immovable).
</dl>
<p>
<dt> <var>special_port</var> 
<dd>
[in thread-special send right]
The value for the port.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>thread_set_special_port</strong> function sets a special
port belonging to <var>thread</var>.
<h3>RETURN VALUES</h3>
<p>
Only generic errors apply.
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="mach_thread_self.html"><strong>mach_thread_self</strong></a>,
<a href="task_get_special_port.html"><strong>task_get_special_port</strong></a>,
<a href="task_set_special_port.html"><strong>task_set_special_port</strong></a>,
<a href="thread_create.html"><strong>thread_create</strong></a>,
<a href="thread_get_special_port.html"><strong>thread_get_special_port</strong></a>.
